<%@ include file="/common/taglibs.jsp"%>
<title><fmt:message key="approve4.title"/></title>
<%
response.setHeader("Cache-Control","no-cache"); // HTTP 1.1
response.setHeader("Pragma","no-cache"); // HTTP 1.0
response.setHeader("Cache-Control", "no-cache,no-store,must-revalidate");
response.setDateHeader ("Expires", -1); // Prevents caching at the proxy server
%>
<script language="JavaScript1.2">
function popExemptBusiness(theURL,winName,features){
	self.name = "Exempt Business List"; 
  	window.open(theURL,winName,features);
	return false;
}
function formatPhone(iForm){
	var form = iForm.form;
    var businessPhoneString = form.businessPhone.value;
    //look in global.js for stripAndFormat() function
    var phone=stripAndFormat(businessPhoneString);
    if(phone != null){
    	form.businessPhone.value = phone;
    	return true;
    }else{
    	return false;
    }
}
</script>
<spring:bind path="associatorView.*">
    <c:if test="${not empty status.errorMessages}">
    <div class="error">
        <c:forEach var="error" items="${status.errorMessages}">
            <img src="<c:url value="/images/iconWarning.gif"/>"
                alt="<fmt:message key="icon.warning"/>" class="icon"/>
            <c:out value="${error}" escapeXml="false"/><br />
        </c:forEach>
    </div>
    </c:if>
</spring:bind>
<c:set var="buttons">
    <input type="submit" class="button" name="_target4" value="<fmt:message key="button.submit.associate.establishment"/>" tabindex="13" />
    <input type="submit" class="button" name="_target0" value="<fmt:message key="button.step1"/>"/>
    <c:choose>
	<c:when test="${requestScope.pageFrom == '1' }">
    <input type="submit" class="button" name="_target1" value="<fmt:message key="button.back"/>"/>
    </c:when>
	<c:otherwise>
    <input type="submit" class="button" name="_target2" value="<fmt:message key="button.back"/>"/>
    </c:otherwise>
    </c:choose>
    <input type="submit" class="button" name="_cancel" value="<fmt:message key="button.cancel"/>"/>
    
</c:set>
<label><fmt:message key="approve4.text"/></label><br>
<fieldset>
<legend><fmt:message key="approve1.business.details"/></legend>
<%@ include file="initialBusinessTable.inc"%>
</fieldset>

<hr class="hrGray"/>


<form:form name="actionItems" commandName="associatorView" method="post" action="/wems/associateComplaint2.wems?tab=pendingComplaints" onsubmit="return validateBusiness(this)">
<form:hidden path="business.businessId" />
<input type="hidden" name="page" value="3" />
<fieldset>
<legend><fmt:message key="approve2.enter.business"/></legend>
<table border="0">
<tr>
	<td align="right">  
		<form:errors path="business.businessName" cssClass="fieldError"/>
	    <label for="business.businessName"><fmt:message key="business.name"/>&#42;</label>
	</td>
	<td align="left">
		<c:choose>
		<c:when test="${requestScope.readonly != null }">
			<form:input path="business.businessName" id="businessName" disabled="true"/>
		</c:when>
		<c:otherwise>
			<form:input path="business.businessName" id="businessName" tabindex="1" />
		</c:otherwise>
		</c:choose>
	</td>
    <td align="right">  
        <form:errors path="business.contactName" cssClass="fieldError"/>
        <label for="business.contactName"><fmt:message key="business.contactname"/></label>
    </td>
    <td align="left">
        <form:input path="business.contactName" id="contactName" tabindex="10" />
    </td>
</tr>
<tr> 
	<td align="right"> 
		<form:errors path="businessCategoryId" cssClass="fieldError"/>
	    <label for="businessCategoryId"><fmt:message key="business.type"/>&#42;</label>
		</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">
		    <form:select id="businessCategoryId" multiple="false" path="businessCategoryId" disabled="true">
		    <form:options items="${sessionScope.businessCategoryList}" itemLabel="value" itemValue="id"/>
		    </form:select>
	    </c:when>
	    <c:otherwise>
		    <form:select id="businessCategoryId" multiple="false" path="businessCategoryId" tabindex="2">
		    <form:options items="${sessionScope.businessCategoryList}" itemLabel="value" itemValue="id"/>
		    </form:select>
	    </c:otherwise>
	</c:choose>
	</td>
    <td align="right">  
        <form:errors path="business.contactTitle" cssClass="fieldError"/>
        <label for="business.contactTitle"><fmt:message key="business.contacttitle"/></label>
    </td>
    <td align="left">
        <form:input path="business.contactTitle" id="contactTitle" tabindex="11" />
    </td>
</tr>
<tr>  
	<td align="right"> 
	    <form:errors path="business.businessAddress1" cssClass="fieldError"/>
	    <label for="bbusiness.usinessAddress1"><fmt:message key="business.address"/>&#42;</label>
	</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">
	  		<form:input path="business.businessAddress1" id="businessAddress1" disabled="true"/>
	  	</c:when>
	  	<c:otherwise>
	  		<form:input path="business.businessAddress1" id="businessAddress1" tabindex="3" />
	  	</c:otherwise>
	</c:choose>
	</td>
    <td align="right">  
        <form:errors path="business.contactEmail" cssClass="fieldError"/>
        <label for="business.contactEmail"><fmt:message key="business.contactemail"/></label>
    </td>
    <td align="left">
        <form:input path="business.contactEmail" id="contactEmail" tabindex="12" />
    </td> 
</tr>
<tr>   
	<td align="right"> 
	    <form:errors path="business.businessAddress2" cssClass="fieldError"/>
	    <label for="business.businessAddress2"><fmt:message key="business.address"/>2</label>
	</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">
	  		<form:input path="business.businessAddress2" id="businessAddress2" disabled="true"/>
	  	</c:when>
	  	<c:otherwise>
	  		<form:input path="business.businessAddress2" id="businessAddress2" tabindex="4" />
	  	</c:otherwise>
	</c:choose>
    <td align="right">  
        <form:errors path="business.businessOwner" cssClass="fieldError"/>
        <label for="business.businessOwner"><fmt:message key="business.owner"/></label>
    </td>
    <td align="left">
        <form:input path="business.businessOwner" id="businessOwner" tabindex="13" />
    </td> 
</tr>
<tr>  
	<td align="right"> 
	    <form:errors path="business.businessCity" cssClass="fieldError"/>
	    <label for="business.businessCity"><fmt:message key="business.city"/>&#42;</label>
	</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">
	  		<form:input path="business.businessCity" id="businessCity" disabled="true"/>
	  	</c:when>
	  	<c:otherwise>
	  		<form:input path="business.businessCity" id="businessCity" tabindex="5" />
	  	</c:otherwise>
	</c:choose>
	</td><td colspan="2"><a href="." onclick="return popExemptBusiness('exemptBusinessView.wems','','width=500,height=350,scrollbars=1')"><fmt:message key="approve4.exempt.url"/></a></td> 
</tr>
<tr>      
	<td align="right"> 
	    <form:errors path="business.businessZip" cssClass="fieldError"/>
	    <label for="business.businessZip"><fmt:message key="business.zip"/>&#42;</label>
	</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">	    
	  		<form:input path="business.businessZip" id="businessZip" disabled="true" size="5" maxlength="5"/>
	  		&#45;<form:input path="business.businessZipExt" id="businessZipExt" disabled="true" size="4" maxlength="4"/>
	  	</c:when>
	  	<c:otherwise>
	  		<form:input path="business.businessZip" id="businessZip" maxlength="5" size="5" tabindex="6" />
	  		&#45;<form:input path="business.businessZipExt" id="businessZipExt" maxlength="4" size="4" tabindex="7" />
	  	</c:otherwise>
	</c:choose>
	</td><td colspan="2">&nbsp;</td>
</tr>
<tr> 
	<td align="right">
		<form:errors path="countyId" cssClass="fieldError"/> 
	    <label for="countyId"><fmt:message key="business.county"/>&#42;</label>
	</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">	    
		    <form:select id="countyId" multiple="false" path="countyId" disabled="true">
		    <form:options items="${sessionScope.countyList}" itemLabel="value" itemValue="id"/>
		    </form:select>
	    </c:when>
	    <c:otherwise>
		    <form:select id="countyId" multiple="false" path="countyId" tabindex="8">
		    <form:options items="${sessionScope.countyList}" itemLabel="value" itemValue="id"/>
		    </form:select>	    
	    </c:otherwise>
	</c:choose>
	</td><td colspan="2">&nbsp;</td>
</tr>
<tr>      
	<td align="right">     
	    <form:errors path="business.businessPhone" cssClass="fieldError" />
	    <label for="business.businessPhone"><fmt:message key="business.phone"/>&#42;</label>
	</td>
	<td align="left">
	<c:choose>
		<c:when test="${requestScope.readonly != null }">	    
	    	<form:input path="business.businessPhone" id="businessPhone" maxlength="14" size="14" disabled="true"/>
	    	&nbsp;Ext:<form:input path="business.businessPhoneExt" id="businessPhoneExt" disabled="true" size="5" maxlength="5"/>
		</c:when>
		<c:otherwise>
	    	<form:input path="business.businessPhone" id="businessPhone" maxlength="14" size="14" onblur="return formatPhone(this);" tabindex="9"/>
	    	&nbsp;Ext:<form:input path="business.businessPhoneExt" id="businessPhoneExt" size="5" maxlength="5" tabindex="9"/>
		</c:otherwise>
	</c:choose>
	</td><td colspan="2">&nbsp;</td>   
</tr>
<tr><td colspan="3" align="center">&#42;Required Field to add new Business
</td></tr>
<tr> 	    
<td class="buttonBar" colspan="4" align="center">
    <c:out value="${buttons}" escapeXml="false"/>
</td>
</tr>
</table>
</fieldset>
</form:form>
